<?php

namespace mpend\modules\commission\controllers;

use Yii;
use mpend\modules\commission\components\Controller;

/**
 * 分销佣金相关接口
 * BrokerageController
 *
 * @author emhome<emhome@163.com>
 * @since 2.0
 */
class BrokerageController extends Controller {

    /**
     * Renders the index view for the module
     * @return string
     */
    public function actionIndex() {
        //会员信息
        $member = $this->member;
        $account = $member->account;

        $days = (time() - $account->created_at) / 86400;

        //账户信息
        return [
            'amount' => number_format($account->amount, 2),
            'current' => number_format($account->current, 2),
            'rate' => intval($member->scale * 100),
            'days' => number_format($days),
        ];
    }

}
